Ext.define('DragonApp.util.Object', {

    statics: {

        /**
         * [toArray description]
         * 对象转数组
         * @DateTime 2017-11-20
         * @param    {object} obj 对象
         * @return   {array}  数组
         */
        toArray: function(obj) {
            var arr = [];
            for (var item in obj) {
                arr[item] = obj[item];
            }
            return arr;
        },

        /**
         * [orderArray description]
         *  对象转数组并按键名升序排列
         * @DateTime 2017-11-20
         * @param    {object} Obj [description]
         * @return   {array} 数组
         */
        orderArray: function(Obj) {
            try {
                var arr = [];
                var keys = Object.keys(Obj).sort();

                for (var i = 0, len = keys.length; i < len; i++) {
                    arr[keys[i]] = Obj[keys[i]];
                }
                return arr;
            } catch (err) {
                console.log("Error name: " + err.name + "");
                console.log("Error message: " + err.message);
            }
        },
        /**
         * [consoleLogObjProp description]
         * [调试] 显示对象属性
         * @param    {object} object 被显示对象
         * @return   void
         */
        consoleLogObj: function(object) {

            console.log(object);
        }
    }
});